Closed loop automated oxygen control